<template>
	<view class="my-search-container" :style="{'background-color':gbcolor}" @click="searchBoxHandler">
		<!-- 通过自定义属性增强组件的通用性，通过props定义bgcolor和radiusliangge -->
		<view class="my-search-box" :style="{'border-radius':radius+'px'}">
			<uni-icons type="search" size="17"></uni-icons>
			<text class="placeholder">搜索</text>
		</view>
	</view>
</template>

<script>
	import uniIcons from "@/components/uni-icons/uni-icons.vue"
	// export default {
	//     components: {uniIcons}
	// }
	export default {
		components: {
			uniIcons
		},
		/* 没有required的时候可以不传值 */
		props:{
			gbcolor:{
				type:String,
				default:'#C00000'
			},
			radius:{
				type:Number,
				default:18 //px
			}
		},
		data() {
			return {

			};
		},
		methods:{
			searchBoxHandler(){
				this.$emit('click')
			}
		}
	}
</script>

<style>
	.my-search-container {
		/* background-color: #c00000; */
		height: 50px;
		/* color:#fff; */
		display: flex;
		align-items: center;
		text-align: center;
		padding: 0 20px;
	}

	.my-search-box {
		background-color: #fff;
		height: 36px;
		display: flex;
		justify-content: center;
		align-items: center;
		/* border-radius: 18px; */
		width: 100%;
	}

	.placeholder {
		font-size: 15px;
		margin-left: 5px
	}
</style>
